<template>
  <div class="add-list">
    <input type="text" placeholder="输入任务名称" v-model="inputText">
    <input type="button" value="新增" @click="add">
  </div>
</template>

<script setup>
// import { storeToRefs } from "pinia";
import { ref } from "vue";
import { useTasklistStore } from "../stores/tasklist";
var store = useTasklistStore();
import { useRouter } from 'vue-router'
var $router=useRouter()
var inputText = ref("");
var add = () => {
  store.addTask(inputText.value);
  $router.push('/index')
};
</script>

<style scoped>
.add-list{
  margin-top: 20px;
  padding: 20px;
}
.add-list input{
    width: 100%;
    height: 40px;
    margin-bottom: 20px;
    outline: none;
    border: none;
    color: white;
    background-color:  rgb(33, 146, 216);
}
.add-list input:nth-child(2){
    box-sizing: border-box;
    background-color: red;
}
</style>